//
//  NSMutableAttributedString+YKOCExection.m
//  YKOCExection
//
//  Created by edward on 2020/6/11.
//  Copyright © 2020 edward. All rights reserved.
//

#import "NSMutableAttributedString+YKOCExection.h"

@implementation NSMutableAttributedString (YKOCExection)

- (void)yk_addStrikeLine
{
    [self yk_addStrikeLineToRange:NSMakeRange(0, self.length)];
}

- (void)yk_addStrikeLineToRange:(NSRange)range
{
//    [self addAttributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle),NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle)} range:range];
    [self addAttributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle),NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle)} range:range];
}
-(void)yk_addAttributes:(NSDictionary *)dic range:(NSRange)range{
    NSDictionary *attdic;
    if(!dic)
    {
        [self addAttributes:@{
            NSForegroundColorAttributeName:UIColor.redColor,
            NSFontAttributeName:[UIFont systemFontOfSize:12]
        } range:range];
    }else
    {
        attdic = dic;
    }
    [self addAttributes:attdic range:range];
}

@end
